import java.util.ArrayDeque;
import java.util.Queue;

public class LeetCode933 {

    Queue<Integer> queue;

    public LeetCode933() {
        queue = new ArrayDeque<>();
    }

    public int ping(int t) {
        queue.offer(t);
        while (t - queue.peek() > 3000){
            queue.poll();
        }

        return queue.size();
    }
}
